Skip to content

Fix Cloudflare SSR 500 on snippet-rendered pages#19

Merged
acoyfellow merged 1 commit intomainfrom
cursor/lab-coey-dev-server-issue-b322
Apr 2, 2026
Merged

Fix Cloudflare SSR 500 on snippet-rendered pages#19
acoyfellow merged 1 commit intomainfrom
cursor/lab-coey-dev-server-issue-b322

Conversation

@acoyfellow
Copy link
Copy Markdown
Owner

What changed

  • Replace the homepage/docs snippet body parser with a small string scanner so Cloudflare SSR no longer imports typescript on routes that render runChain snippets.
  • Add a focused regression test covering nested template expressions inside body template literals.

Why

  • lab.coey.dev was returning 500 for / and /docs/patterns while /compose still worked.
  • The failing routes shared src/lib/lab-chain-snippet.server.ts, which imported typescript in the server bundle. That dependency is not safe in the Cloudflare SSR runtime for these pages.
  • After this change, the built server output no longer contains a typescript import for that snippet renderer, and the affected route loaders execute successfully.

Test plan

  • bun test src/lib/lab-chain-snippet.server.test.ts
  • bun run build
  • bun run check
  • Route-loader verification via direct execution of src/routes/+page.server.ts and src/routes/docs/patterns/+page.server.ts

Risk / security notes

  • No capability boundary changes.
  • Change is limited to server-side demo snippet parsing/highlighting for homepage and docs pages.
Open in Web Open in Cursor 

Co-authored-by: Jordan Coeyman <jordan@sendgrowth.com>
@acoyfellow acoyfellow marked this pull request as ready for review April 2, 2026 11:04
@acoyfellow acoyfellow merged commit be2d613 into main Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants